const Router = require('koa-router')
const {auth} = require('../middleware/auth.middleware')
const {getUserRoleDetailById, saveUserRole} = require('../controller/userRoleController')
const {UserRoleValidator} = require('../middleware/role.middleware')

const UserRoleRouter = new Router({prefix: '/user/role'})

//获取当前用户的角色
UserRoleRouter.get('/detail/:id', auth, getUserRoleDetailById)

//保存当前用户的角色
UserRoleRouter.post('/save', auth, UserRoleValidator, saveUserRole)

module.exports = UserRoleRouter;